<?php

namespace Open\Widgets;

class Navigation extends \Shared\Widgets\Widget {

    public function paste() {
        $this->view        = new \System\Template('@open\Widgets\navigation.twig');
        $this->view->pages = $this->getPages();
        
        return $this->view->paste();
    }
    
    private function getPages() {
        $QB    = $this->EntityManager->createQueryBuilder();
        $pages = $QB->select('p')
                ->from('Shared\Main\Page', 'p')
                ->orderBy('p.order', 'ASC')
                ->getQuery()->getResult();
        
        return $pages;
    }
}
